<template>
  <div class="app-container">
    <el-form ref="form" :model="formInline" >
      <el-form-item label=" 机器人名 "  >
        <el-input v-model="formInline.botName" style="width: 30%"  />
      </el-form-item>
      <el-form-item label="企业微信群">
        <el-input v-model="formInline.botGroup" style="width: 30%"/>
      </el-form-item>
      <el-form-item label="webhook">
        <el-input v-model="formInline.botWebhook" style="width: 30%"/>
      </el-form-item>
      <el-form-item label="备注信息">
        <el-input v-model="formInline.remark" style="width: 30%"/>
      </el-form-item>
      <el-form-item>
      <el-button type="primary" @click="onSubmit">新增</el-button>
      </el-form-item>
    </el-form>

  </div>
</template>

<script>
/* eslint-disable */
  export default {
  data() {
    return {
      formInline: {
        botId: '',
        botName: '',
        botGroup: '',
        botWebhook: '',
        createTime: '',
        remark: ''
      }
    }
  },
  methods: {
    onSubmit() {

      var vm = this
      this.axios({
        method: 'POST',
        url: 'http://localhost:8080/bot/addBot',
        data: this.formInline
      }).then(resp => {
          if (resp.data == 'success') {
            // 弹框
            vm.$message({
              message: '新增成功',
              type: 'success'
            })
          } else {
            vm.$message.error('删除失败')
          }
        // 添加成功后前往邮箱列表页->index
        vm.$router.push({
          name: 'bot',
          path: '/bot'
        })
      }
      )
    }
  }
}
</script>

